package org.funsciencewithyourcomputer.client;

import com.google.gwt.i18n.client.LocaleInfo;

public class NLS {

	public static final String[] DICTIONARY = new String[] {
			"dictionary_en.txt", "dictionary_fr.txt" };

	public static final String[] GAME_NAME = new String[] {
			"Steg - Eat letters one word at a time!",
			"Steg - Mangez des lettres avec chaque mot!" };

	public static final String[] LOADING = new String[] { "Loading...",
			"En cours de chargement..." };

	public static final String[] START = new String[] { "Start", "Jouer" };

	public static final String[] PAUSE = new String[] { "Pause",
			"Faire une pause" };

	public static final String[] STOP_GAME = new String[] { "End Game",
	"Terminer le jeu" };
	
	public static final String[] RESUME = new String[] { "Resume", "Continuer" };

	public static final String[] GAME_OVER = new String[] {
			"GAME OVER    Score:  {0}", "TERMINE   Score:  {0}" };

	public static final String[] GAME_STATUS = new String[] {
			"SCORE:  {0}    TIME:  {1} seconds",
			"Score:  {0}    Temps:  {1} secondes" };

	public static final String[] GAME_OVER_ORIGINAL = new String[] {
		"GAME OVER    Letters remaining:  {0}", "TERMINE   Lettres restantes:  {0}" };

	public static final String[] GAME_STATUS_ORIGINAL = new String[] {
		"Letters remaining:  {0}", "Lettres restantes:  {0}" };

	public static final String[] RANKING_RANK = new String[] { "Rank",
			"Position" };

	public static final String[] RANKING_NAME = new String[] { "Name", "Nom" };

	public static final String[] RANKING_SCORE = new String[] { "Score",
			"Score" };

	public static final String[] TAB_PLAY = new String[] { "Play", "Jeu" };

	public static final String[] TAB_RANKING = new String[] { "High Scores",
			"Meilleurs Scores" };

	public static final String[] TAB_INFO = new String[] { "Instructions",
			"Règles du jeu" };

	public static final String[] TAB_HOWTO = new String[] {
			"<p>Steg is a game for people who love words and puzzles. Your objective is to empty the screen of all its letters.<p>"
					+ "<p>Press 'Start' to begin. Letters fill up the screen. You must form valid words by mixing the letters appearing on a row or on a column.<p>"
					+ "<p>You enter the words using the keyboard and press 'Enter'. If the word is valid the corresponding letters are removed from the rows and columns they appear in.<p>"
					+ "<p>After a certain delay, new letters are inserted in the game so you must be fast enough.<p>"
					+ "<p>You win when you empty the screen entirely - that's called 'doing a Steg'. The game is over if the letters fill up the screen faster than you 'consume' them.<p>"
					+ "<p>Doing a Steg is challenging. However you also score by finding words at your own pace so just go and have fun!<p>",
			"<p>Steg est un jeu pour les amoureux des mots et de puzzles. Votre objectif est de vider la grille de toutes ses lettres.<p>"
					+ "<p>Appuyez 'Jouer' pour commencer. Les lettres remplissent la grille. Vous devez former des mots valides en utilisant des lettres d'une même ligne ou d'une même colonne.</p>"
					+ "<p>Après un certain délai, de nouvelles lettres sont insérées dans la grille et vous devez donc être suffisemment rapide.<p>"
					+ "<p>Vous gagnez quand vous avez vidé la grille completement - c'est ce qui s'appelle 'réussir un Steg'. Le jeu est perdu quand les lettres remplissent la grille plus rapidement que vous ne les 'consommez'.<p>"
					+ "<p>Réussir un Steg est difficile. Cependant vous gagnez des points également en trouvant des mots à votre propre rythme, alors essayez maintenant et amusez vous!<p>" };

	public static final String[] SWITCH_LANGUAGE = new String[] {
			"Steg uses an english dictionary to check the words you enter. <a href=\"http://www.funsciencewithyourcomputer.org/gwt/steg/steg.html?locale=fr\">Switch to french</a>",
			"Steg vérifie vos mots avec un dictionnaire français. <a href=\"http://www.funsciencewithyourcomputer.org/gwt/steg/steg.html\">Utiliser un dictionnaire en anglais</a>" };

	public static final String[] INPUT_INFO = new String[] {
			"<type your word here>", "<entrez votre mot ici>" };

	public static final String[] COPYRIGHTS = new String[] {
			"Beta 0.7, Chrix, 2009", "Beta 0.7, Chrix, 2009" };

	public static final String[] MODE_ORIGINAL = new String[] {
			"Default Mode - the original Steg game",
			"Mode Standard - le jeu original Steg" };
	public static final String[] MODE_ACTION = new String[] {
			"Action Mode - Steg game with a clock",
			"Mode Action - le jeu Steg avec un chronomètre" };

	public static final String[] PROGRESS_LOAD_DICTIONARY = new String[] {
		"Please wait... I am reading the english dictionary",
		"SVP patientez... Je suis en train de lire le dictionnaire français"
	};

	public static final String[] PROGRESS_DICTIONARY = new String[] {
		"Almost ready to start game... I am learning {0} words",
		"Presque prêt à commencer le jeu... J'apprends {0} mots"
	};
	
	public static String get(String[] message) {
		return LocaleInfo.getCurrentLocale().getLocaleName().equals("fr") ? message[1]
				: message[0];
	}

	public static String get(String[] message, Object[] args) {
		String result = get(message);
		for (int i = 0; i < args.length; i++) {
			result = result.replaceAll("\\{" + i + "\\}", args[i].toString());
		}
		return result;
	}
}
